home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / MATHS / ARCAUT / Automatons / Critter < prev    next >
Text File  |  1991-07-30  |  955b  |  41 lines

  1. AUTOMATON*
  2.  
  3.   Critter
  4.  
  5.   A two state automaton in which most cells reverse their state with each
  6.   generations (this can lead to a painful flashing display, hence the subdued
  7.   colours). From a random blob of mixed states on a plain background, strange
  8.   four cell 'critters' mysteriously appear, wander across the display, & then
  9.   fall back into the oblivion from which they came. This uses the margolus
  10.   neighbourhood. Try 253x14 & other small windows.
  11.  
  12. INITIALISATION*
  13.  
  14.   10DEF PROCdo
  15.   20*SetEval wrap on
  16.   30*SetEval neig margolus
  17.   40*SetEval i 10
  18.   50ENDPROC
  19.  
  20. SCREEN*
  21.  
  22.   10DEF PROCdo   
  23.   20DIM buf% 256:SYS "OS_ReadVarVal","i",buf%,256
  24.   30c%=FNacol(!buf%)
  25.   40GCOL c%AND63 TINT c%
  26.   50FOR Q%=1 TO 200
  27.   60POINT RND(80)-40,RND(80)-40
  28.   70NEXT
  29.   80ENDPROC
  30.  
  31. CODE*
  32.  
  33. ( READ_NEIG
  34.   <i> SCOUNT_ALL
  35.   DUP 0 = IF (CELL <i> EOR ==)
  36.   DUP 1 = IF (CELL <i> EOR ==)
  37.   DUP 2 = IF (CELL ==)
  38.       3 = IF (OPP <i> EOR ==)
  39.               CELL <i> EOR ==  )
  40.  
  41. END*